Import('env')

global_env = env.Clone()
global_env['extension'] = 'cpp'
global_env['srcroot'] += '/global'
global_env['objroot'] += '/global'

Export('global_env')

src_files = [
  'quorum_peer_server.cpp',
  'quorum_peer_manager.cpp',
  'fast_leader_election.cpp',
  'data_tree.cpp',
  'transaction_log.cpp',
  'snap_log.cpp',
  'transaction_log_header.cpp',
  'transaction_log_iterator.cpp',
  'utility.cpp',
  'serialize_utility.cpp',
  'data_node_header.cpp',
  'record.pb.cc',
  'transaction.pb.cc',
]

protobuf_files = [
  '../protocol/server_config.pb.cc',
  '../protocol/leader_election.pb.cc',
]

global_env.ProtocolBuffer('transaction.proto')
global_env.ProtocolBuffer('record.proto')
global_env.StaticLibrary('global', src_files + protobuf_files)
global_env.Prepend(LIBS=
  [
    'eventrpc',
    'global',
  ])
global_env.Append(LIBPATH=[env['objroot']+'/global',])
global_env.Program("global_main", ["global_main.cpp"])
